package flyrestaurant.jcy.service;

import java.util.HashMap;
import java.util.Map;

import android.content.Context;
import flyrestaurant.jcy.App;
import flyrestaurant.jcy.HttpUtils;
import flyrestaurant.jcy.entity.User;

public class UserService {
	App app;
	public UserService(Context context) {
		app = (App) context.getApplicationContext();
	}
	
	public User login(String code,String password) throws Exception{
//		if("test".equals(code) && "test".equals(password)){
//			User u = new User();
//			u.id = 1;
//			u.code = code;
//			u.password = password;
//			u.name = "����";
//			return u;
//		}
//		return null;
//	}
		String url = app.serverUrl + "/?to=login";
		Map<String,String> params = new HashMap<String,String>();
		params.put("code", code);
		params.put("password", password);
		User user = (User) HttpUtils.post(url,params);
		return user;
}
}
